const path = require('path')

function resolve(dir) {
    return path.join(__dirname, '..', dir)
}

module.exports = {
    pages: {
        index: {
            entry: 'examples/main.js',
            template: 'public/index.html',
            filename: 'index.html'
        }
    },
    chainWebpack: config => {
        config.module
            .rule('js')
            .include
            .add(resolve('packages'))
            .end()
            .use('babel')
            .loader('babel-loader')
            .tap(options => {
                return options
            })
    },
    devServer: {
        port: 8080,
        open: true,
        disableHostCheck: true,
        proxy: {
            "/api": {
                target: 'http://192.168.1.198:8760',
                changeOrigin: true,
                logLevel: "debug",
                pathRewrite: {
                    "^/api/": "/"
                }
            },
        }
    }

}